package com.commerce.model;

import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author wyj
 * @Title:
 * @Description:
 */
@Data
public class Admin {

    private int id;
    private String account;//账号
    private String password;//密码
    private String name;//姓名
    private String imgurl;//头像
    private boolean open;//开启与关闭
    private String role_ids;//拥有的角色
    private Date create_time;//创建时间


    private String authoritys;//该账号拥有的权限
    List<Menu> menus;//拥有的菜单

    List<Integer> role;//
    List<Role> roles;//拥有的角色

    public void rold_idsUtil(){
        if(role == null || role.size() == 0){
            return ;
        }
        role_ids="";
        for (Integer id : role){
            if(id == null)
                continue;
            role_ids +=id+",";
        }
        role_ids = role_ids.substring(0,role_ids.length() - 1);
    }

    public void authoritysUtil(List<Menu> list){
        authoritys = "";
        for (Menu m : list){
            authoritys+=m.getAuthorization()+",";
        }
    }
}
